#-*- codeing = utf-8 -*-
#@Time: 2020/7/9 22:30
#@Author: YANGYUJIE
#@File: spider_book.py
#@Software: PyCharm

from spider_dangdang import spider as dangdang
from spider_yihaodian import spider as yhd

def main(sn):
    # 图书比价工具整合
    book_list = []
    # 当当网的数据
    print('当当网数据爬取完成！')
    dangdang(sn, book_list)

    # 一号店的数据
    print('一号店数据爬取完成！')
    yhd(sn, book_list)

    # 打印所有数据列表
    for book in book_list:
        print(book)
    print('----start resort-----')
    # 排序书的数据
    book_list = sorted(book_list, key=lambda item: float(item["price"]), reverse=True)
    for book in book_list:
        print(book)

if __name__ == '__main__':
    sn = input('请输入ISBN：')
    main(sn)